import json

import requests
from api.baseapi import BaseApi
from url.gettoken import gettokenurl

class GetToken(BaseApi):
    def getToken(self):
        url = self.getUrl(gettokenurl.gettokenurl)
        self.logs("请求url", url)

        data = {
            "corpid": "ww96573e37a5a563e7",
            "corpsecret": "hFkYKQuV1YkaDUlbxcvGzL-RHCkbaRXFgAJBIiH6AT4"
        }
        self.logs("请求数据", json.dumps(data))

        res = requests.get(url, params=data)
        self.logs("获取token", res.json()["access_token"])

        return res.json()["access_token"]


if __name__ == '__main__':
    GetToken().getToken()
